/*
 * createOrder.java
 *
 * Created on February 17, 2006, 6:13 AM
 */

package phs_project;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import javax.swing.*;
import java.sql.*;
import phs_project.hotelForm;
import java.util.*;
import java.text.*;

/**
 *
 * @author  TUNG
 */
public class createOrder extends javax.swing.JDialog {
    public Connection con;
    public String bedate="";
    public String endate="";
    public static Vector vector;
    /** Creates new form createOrder */
    public createOrder(String begindate,String enddate,Vector vt){
        System.out.print("Tao don hang");
        this.bedate = begindate;
        this.endate = enddate;
        this.vector = vt;
        System.out.println(bedate);
        System.out.println(endate);
        System.out.println(vector);
        initComponents();
       // addItemTooCombobox(OrderList,"Select OrderId from orders ","Chọn một đơn hàng");
        
        addDataCombobox();
        addDataCombo();        
        df1 = new SimpleDateFormat("MM/dd/yy HH:mm:ss");
        cbxNgay.setText(df1.format(new java.util.Date()));
        cbxromforcusmt();
        
        
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        cbxNGay = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtOrderDescrib = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        cbxLDH = new javax.swing.JComboBox();
        rdbNo = new javax.swing.JRadioButton();
        rdbYes = new javax.swing.JRadioButton();
        cbxNgay = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        OrderList = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        txtFirstName = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        txtLastName = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        txtIdCard = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        rdbMale = new javax.swing.JRadioButton();
        rdbFemale = new javax.swing.JRadioButton();
        jLabel9 = new javax.swing.JLabel();
        txtAddress = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        txtEmail = new javax.swing.JTextField();
        btnSearch = new javax.swing.JButton();
        jLabel13 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        txtCusDescrib = new javax.swing.JTextArea();
        jPanel3 = new javax.swing.JPanel();
        btnSave = new javax.swing.JButton();
        btnClear = new javax.swing.JButton();
        btnCancel = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        cbxromforcus = new javax.swing.JComboBox();
        cbxcustomer = new javax.swing.JComboBox();
        txtAge = new javax.swing.JTextField();
        txtPhone = new javax.swing.JTextField();
        txtCountry = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setAlwaysOnTop(true);
        setResizable(false);
        cbxNGay.setBorder(javax.swing.BorderFactory.createTitledBorder("T\u1ea1o \u0111\u01a1n h\u00e0ng m\u1edbi"));
        jLabel1.setText("Ng\u00e0y \u0111\u1eb7t");

        jLabel2.setText("Ch\u00fa th\u00edch");

        jLabel14.setText("Lo\u1ea1i \u0111\u01a1n h\u00e0ng");

        buttonGroup3.add(rdbNo);
        rdbNo.setText("Th\u00eam ph\u00f2ng v\u00e0o");
        rdbNo.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        rdbNo.setMargin(new java.awt.Insets(0, 0, 0, 0));
        rdbNo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                rdbNoMouseClicked(evt);
            }
        });

        buttonGroup3.add(rdbYes);
        rdbYes.setSelected(true);
        rdbYes.setText("\u0110\u01a1n h\u00e0ng m\u1edbi");
        rdbYes.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        rdbYes.setMargin(new java.awt.Insets(0, 0, 0, 0));
        rdbYes.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                rdbYesMouseClicked(evt);
            }
        });

        cbxNgay.setEditable(false);

        jLabel15.setText("\u0110\u01a1n h\u00e0ng");

        org.jdesktop.layout.GroupLayout cbxNGayLayout = new org.jdesktop.layout.GroupLayout(cbxNGay);
        cbxNGay.setLayout(cbxNGayLayout);
        cbxNGayLayout.setHorizontalGroup(
            cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(cbxNGayLayout.createSequentialGroup()
                .addContainerGap()
                .add(cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 59, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel14)
                    .add(jLabel2))
                .add(12, 12, 12)
                .add(cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(txtOrderDescrib, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 191, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(cbxNGayLayout.createSequentialGroup()
                        .add(cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, cbxLDH, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 102, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, cbxNgay, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 105, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(87, 87, 87)
                        .add(cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(cbxNGayLayout.createSequentialGroup()
                                .add(rdbYes)
                                .add(27, 27, 27)
                                .add(rdbNo))
                            .add(cbxNGayLayout.createSequentialGroup()
                                .add(jLabel15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 63, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .add(OrderList, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 136, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(97, 97, 97)))))
                .addContainerGap())
        );
        cbxNGayLayout.setVerticalGroup(
            cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(cbxNGayLayout.createSequentialGroup()
                .addContainerGap()
                .add(cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(cbxNgay, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(rdbYes)
                    .add(jLabel1)
                    .add(rdbNo))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(cbxLDH, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel14)
                    .add(jLabel15)
                    .add(OrderList, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(cbxNGayLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(txtOrderDescrib, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel2)))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jLabel3.setText("H\u1ecd \u0111\u1ec7m");

        jLabel4.setText("T\u00ean");

        jLabel5.setText("S\u1ed1 CMT");

        jLabel7.setText("Gi\u1edbi");

        buttonGroup1.add(rdbMale);
        rdbMale.setSelected(true);
        rdbMale.setText("Nam");
        rdbMale.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        rdbMale.setMargin(new java.awt.Insets(0, 0, 0, 0));

        buttonGroup1.add(rdbFemale);
        rdbFemale.setText("N\u1eef");
        rdbFemale.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        rdbFemale.setMargin(new java.awt.Insets(0, 0, 0, 0));

        jLabel9.setText("\u0110\u1ecba ch\u1ec9");

        jLabel11.setText("Th\u01b0");

        btnSearch.setText("Search");

        jLabel13.setText("Ghi ch\u00fa");

        txtCusDescrib.setColumns(20);
        txtCusDescrib.setRows(5);
        jScrollPane2.setViewportView(txtCusDescrib);

        org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel5)
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel3)
                            .add(jLabel11)
                            .add(jLabel9)
                            .add(jLabel7)
                            .add(jLabel4)
                            .add(jLabel13))
                        .add(32, 32, 32)
                        .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(jScrollPane2)
                            .add(jPanel2Layout.createSequentialGroup()
                                .add(rdbMale)
                                .add(41, 41, 41)
                                .add(rdbFemale))
                            .add(txtEmail)
                            .add(txtAddress)
                            .add(txtFirstName)
                            .add(txtLastName)
                            .add(txtIdCard, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 169, Short.MAX_VALUE))))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(btnSearch, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(txtFirstName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(btnSearch))
                .add(0, 0, 0)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4)
                    .add(txtLastName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(20, 20, 20)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel5)
                    .add(txtIdCard, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel7)
                    .add(rdbMale)
                    .add(rdbFemale))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel9)
                    .add(txtAddress, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel11)
                    .add(txtEmail, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel2Layout.createSequentialGroup()
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel13))
                    .add(jPanel2Layout.createSequentialGroup()
                        .add(15, 15, 15)
                        .add(jScrollPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 71, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(19, Short.MAX_VALUE))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        btnSave.setText("Save");
        btnSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSaveActionPerformed(evt);
            }
        });

        btnClear.setText("Clear");

        btnCancel.setText("Cancel");
        btnCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCancelActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .add(136, 136, 136)
                .add(btnClear)
                .add(28, 28, 28)
                .add(btnSave)
                .add(28, 28, 28)
                .add(btnCancel)
                .addContainerGap(321, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(btnClear)
                    .add(btnSave)
                    .add(btnCancel))
                .addContainerGap(11, Short.MAX_VALUE))
        );

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel16.setText("Ph\u00f2ng s\u1ebd \u1edf");

        jLabel6.setText("Ki\u1ec3u");

        jLabel8.setText("Tu\u1ed5i");

        jLabel10.setText("\u0110i\u1ec7n tho\u1ea1i");

        jLabel12.setText("Qu\u1ed1c t\u1ecbch");

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel6)
                    .add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup()
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 89, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jLabel8)
                            .add(jLabel10)
                            .add(jLabel12))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, txtCountry, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, txtPhone, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, txtAge, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, cbxcustomer, 0, 159, Short.MAX_VALUE)
                            .add(cbxromforcus, 0, 159, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel16)
                    .add(cbxromforcus, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel6)
                    .add(cbxcustomer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel8)
                    .add(txtAge, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(txtPhone, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel10))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(txtCountry, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel12))
                .addContainerGap(132, Short.MAX_VALUE))
        );

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                        .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, cbxNGay, 0, 579, Short.MAX_VALUE)
                            .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
                                .add(jPanel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                        .add(127, 127, 127))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(cbxNGay, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(17, 17, 17)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .add(496, 496, 496)
                .add(jPanel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pack();
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        java.awt.Dimension dialogSize = getSize();
        setLocation((screenSize.width-dialogSize.width)/2,(screenSize.height-dialogSize.height)/2);
    }// </editor-fold>//GEN-END:initComponents

    private void rdbYesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rdbYesMouseClicked
// TODO add your handling code here:
        OrderList.removeAllItems();
    }//GEN-LAST:event_rdbYesMouseClicked

    private void rdbNoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_rdbNoMouseClicked
// TODO add your handling code here:
        
        
         addItemTooCombobox(OrderList,"Select OrderId from orders ","Đơn hàng vừa tạo");
        
    }//GEN-LAST:event_rdbNoMouseClicked

    private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelActionPerformed
// TODO add your handling code here:
        this.dispose();
    }//GEN-LAST:event_btnCancelActionPerformed

    private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
    // TODO add your handling code here:
        insertCus();
        insert_Order();
        //this.dispose();
        
    }//GEN-LAST:event_btnSaveActionPerformed
    private void insertCus(){
               
            String gioi ;
            gioi ="";
            String sqlinsertCustomers;
            if(rdbFemale.isSelected()){
                gioi="Nu";
            }
            if(rdbMale.isSelected()){
                gioi="Nam";
            }
            sqlinsertCustomers =" insertcustomer '"+txtFirstName.getText()+"','"+txtLastName.getText()+"','"+
                    cbxcustomer.getSelectedItem().toString()+
                    "','"+txtIdCard.getText()+"','"+gioi+"','"+txtAge.getText()+"','"+
                    txtAddress.getText()+"','"+txtPhone.getText()+"','"+
                    txtEmail.getText()+"','"+txtCountry.getText()+"','"+txtCusDescrib.getText()+"'";
            
             //System.out.println(sqlinsertCustomers);
             //SQLRUN(sqlinsertCustomers);   // Dua du lieu vao bang khach hang
       
    }
    private void cbxromforcusmt(){
        if (vector==null) 
        {
            System.out.println("Chua co vector");
           JOptionPane.showMessageDialog(this,"Chưa có room nào để tạo đơn  hàng");
        } 
        else 
        {
       
            for(int j=0;j<vector.size();j++)
           {
               sqlroom = "select roomNumb from rooms where roomid ='"+vector.get(j).toString()+"'";
               
                //cbxromforcus.addItem(vector.get(j).toString());
               try{
                con = new connectDatabase().getConnection();
        	Statement  st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
        	//String sql = "select  name from  customerstype";
		ResultSet rs = st.executeQuery(sqlroom);	
        	//cbxcustomer.addItem("Chon 1");
        	while(rs.next()){
	            cbxromforcus.addItem(rs.getString(1));
			}
        	rs.close();
	}
	catch(SQLException ce){
            System.out.print(ce);
	}
               

            }
        } // ket thuc viec tao don hang
    }
    private void insert_Order(){
        //CallableStatement csOrder;
        Vector vector = hotelForm.vt;
        String sqlcreat ="";
        String sqlcreateorder ="" ;
            for(int i=0;i<vector.size();i++){
                //csOrder = con.prepareCall("{Call creatorder(?,?,?,?,?,?,?)}");
                String Taomoi ;
                Taomoi ="";
                if(rdbYes.isSelected()){
                    Taomoi="YES";
                }
                if(rdbNo.isSelected()){
                    Taomoi="NO";
                }
                sqlcreateorder =" execute creatorder '"+Taomoi+"','"+txtOrderDescrib.getText()+"','"+cbxNgay.getText()+"','"+
                        cbxLDH.getSelectedItem().toString()+"','"+vector.get(i).toString()+"','"+bedate+"','"+endate+"'";
               
                //System.out.println(sqlcreateorder);
                SQLRUN(sqlcreateorder);
            }
        
        }
    
    
    /*  */  
    
    /**
     * @param args the command line arguments
     */
  
	private void addDataCombobox(){ // Function add data to combobox	
    	try{
                con = new connectDatabase().getConnection();
        	Statement  st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
        	String sql = "select  name from  customerstype";
		ResultSet rs = st.executeQuery(sql);	
        	//cbxcustomer.addItem("Chon 1");
        	while(rs.next()){
	            cbxcustomer.addItem(rs.getString(1));
			}
        	rs.close();
	}
	catch(SQLException ce){
            System.out.print(ce);
	}
	}//end
        private void addDataCombo(){
      try{
          Statement  st = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
            String sql = "select status_detail from order_status";
            ResultSet rs = st.executeQuery(sql);	
            //cbxLDH.addItem("Chọn loại đơn hàng");
            while(rs.next()){
	        cbxLDH.addItem(rs.getString(1));
            }
            rs.close();
	}
	catch(SQLException ce){
            System.out.print(ce);
	}
        }
        
        public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                //new createOrder(hotelForm.,enddate,vector).setVisible(true);
            }
        });
    }
    private DateFormat df1;
    private String sqlroom ;
    
    
    // Phan cua tuan chip sua lai
   
   
    // COPY Tu day di tat ca cac form
                                  /* import cac goi nay
                                   import java.sql.Connection;
                                    import java.sql.ResultSet;
                                    import java.sql.ResultSetMetaData;
                                    import java.sql.Statement;
                                    import javax.swing.JOptionPane;
                                    import javax.swing.JTable;
                                    import javax.swing.JTextField;
                                   
                                   */
    private void SQLRUN (String SQLTEXT) // Ham de chay cau truy van
     {
       try{
            Connection conn = new connectDatabase().getConnection();
            Statement stm = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
            stm.execute(SQLTEXT);
            conn.close();
            stm.close();
            System.out.println(SQLTEXT);
        }
        catch(Exception e){
            e.printStackTrace();
        }
    }
     private String  SelectedRowToString (JTable TableName, int CollNumb ) // Lay va In ten truong thu CollNumb ra  bietn ReturnValua, lay 1 bien
      {
        //int CollNumb ;
        //CollNumb=0;
        int  RowSelected;
        String ReturnValue;
        RowSelected = TableName.getSelectedRow();
        ReturnValue=TableName.getValueAt(RowSelected,CollNumb).toString();
        System.out.println(ReturnValue+" ");
        return ReturnValue;
        //System.out.println(TableName.getValueAt(RowSelected,CollNumb));
        
      }
    private void addItemTooCombobox(JComboBox ComboboxName,String sqlcb,String FirstChoice) // Dua du lieu tu cau truy van vao combobox, chi co 1 truong trong du lieu
     {
        //String sqlcb = "select TenTruogn from TenBang";
        if (FirstChoice!=""){
         ComboboxName.addItem(FirstChoice);
        }
         new sqlDatabase().addDataCombobox(sqlcb,ComboboxName);
     }
      
     private void addItemToTable(JTable TableName,String sqltb )// Lay du lieu tu cau truy van dua vao tabe, nhieu ten bang
     {
      
            //String sqltb=  "select * from Tenbang";
            new sqlDatabase().addDataTable(sqltb,TableName);
       
     }
    
                             //  Copy tu day di tat ca cac form
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox OrderList;
    private javax.swing.JButton btnCancel;
    private javax.swing.JButton btnClear;
    private javax.swing.JButton btnSave;
    private javax.swing.JButton btnSearch;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.JComboBox cbxLDH;
    private javax.swing.JPanel cbxNGay;
    private javax.swing.JTextField cbxNgay;
    private javax.swing.JComboBox cbxcustomer;
    private javax.swing.JComboBox cbxromforcus;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JRadioButton rdbFemale;
    private javax.swing.JRadioButton rdbMale;
    private javax.swing.JRadioButton rdbNo;
    private javax.swing.JRadioButton rdbYes;
    private javax.swing.JTextField txtAddress;
    private javax.swing.JTextField txtAge;
    private javax.swing.JTextField txtCountry;
    private javax.swing.JTextArea txtCusDescrib;
    private javax.swing.JTextField txtEmail;
    private javax.swing.JTextField txtFirstName;
    private javax.swing.JTextField txtIdCard;
    private javax.swing.JTextField txtLastName;
    private javax.swing.JTextField txtOrderDescrib;
    private javax.swing.JTextField txtPhone;
    // End of variables declaration//GEN-END:variables
    // Bien khai bao them
   // private int j;
}
